@page
@{ Layout = "_LayoutHome"; }
@section Styles{
    <style>
        .el-form-item {
            margin-bottom: 0px;
        }
        body{
            padding: 0;
            margin: 0;
            background-color: #ffffff;
        }

        html{
            padding: 0;
            margin: 0;
            background-color: #ffffff;
        }
    </style>
}
<el-card class="rounded-0">
    <div class="d-flex justify-content-between align-items-center">
        <div>
            <h2 class="h1 fw-bold">考试中心</h2>
            <small>共 {{total}} 场考试安排</small>
        </div>
        <div>
            <el-form :inline="true" :model="form">
                <el-form-item label="开考时间">
                    <el-select v-model="form.date" placeholder="开考时间">
                        <el-option label="全部" value=""></el-option>
                        <el-option label="今天" value="today"></el-option>
                        <el-option label="三天内" value="three"></el-option>
                        <el-option label="一周内" value="week"></el-option>
                        <el-option label="当月" value="month"></el-option>
                        <el-option label="当年" value="year"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item label="试卷">
                    <el-input prefix-icon="el-icon-search" v-model="form.keyWords" placeholder="关键字"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" plain icon="el-icon-search" v-on:click="btnSearchClick">查询</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</el-card>
<div class="p-3" v-if="total>0">
    <div class="ms-5 position-relative card-hover-with-icon animate__animated animate__fadeInRight" v-for="(paper,index) in list" v-on:click="btnViewClick(paper)">
        <div class="position-absolute top-50 start-0 translate-middle">
            <div class="position-relative">
                <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="13" y="10" width="28" height="34" fill="none" stroke="#333" stroke-width="1" stroke-linejoin="miter" /><path d="M35 10V4H8C7.44772 4 7 4.44772 7 5V38H13" stroke="#333" stroke-width="1" stroke-linecap="round" stroke-linejoin="miter" /><path d="M21 22H33" stroke="#333" stroke-width="1" stroke-linecap="round" stroke-linejoin="miter" /><path d="M21 30H33" stroke="#333" stroke-width="1" stroke-linecap="round" stroke-linejoin="miter" /></svg>
                <span class="position-absolute top-100 start-100 translate-middle mt-1 fs-6">{{ index+1 }}</span>
            </div>
        </div>
        <el-card class="rounded-0 border-start-0 border-end-0" shadow="hover">
            <div class="row align-items-center g-3 ms-6">
                <div class="col">
                    <div class="mb-2">
                        <el-link :underline="false" v-on:click.stop="btnViewClick(paper)">
                            <span class="fw-bold card-icon px-3 py-1 rounded-pill" :class="paper.myExamTimes>0?'bg-white':'bg-warning text-white'">{{ paper.title }}</span>
                        </el-link>
                    </div>
                    <ul class="list-inline fw-light ms-3">
                        <li class="list-inline-item fs-5 text-warning fw-bold" v-if="paper.planId>0 || paper.courseId>0">
                            <el-tooltip class="item" effect="dark" :content="paper.courseName" placement="right">
                                <span>课后考试</span>
                            </el-tooltip>
                        </li>
                        <li class="list-inline-item fs-5">
                            总分：{{paper.totalScore}}
                        </li>
                        <li class="list-inline-item fs-5">
                            及格分：{{paper.passScore}}
                        </li>
                        <li class="list-inline-item fs-5">
                            开考时间：{{ paper.examStartDateTimeStr }}
                        </li>
                        <li class="list-inline-item fs-5">
                            剩余考试次数：
                            <span class="fs-3 text-success fw-bold" v-if="(paper.userExamTimes-paper.myExamTimes)>0">
                                {{paper.userExamTimes-paper.myExamTimes}}
                            </span>
                            <span class="fs-3 text-danger fw-bold" v-else>
                                0
                            </span>
                            /{{paper.userExamTimes}}
                        </li>
                    </ul>
                </div>
                <div class="col-auto">
                    <div class="bg-light p-2 rounded-pill">
                        <el-button type="primary" plain icon="el-icon-s-order" class="rounded-pill" v-on:click.stop="btnViewClick(paper)">详 细</el-button>
                    </div>
                </div>
            </div>
        </el-card>
    </div>
    <div class="my-5 text-center">
        <el-button icon="el-icon-refresh-right" v-if="list.length>0 && list.length<total" v-on:click="btnLoadMoreClick" :loading="loadMoreLoading">加载更多</el-button>
        <small v-else>没有更多了</small>
    </div>
</div>
<div class="pt-10" v-else>
    <el-empty image="/sitefiles/assets/images/nodata.svg"></el-empty>
</div>

@section Scripts{
    <script src="/sitefiles/assets/js/home/exam/examPaper.js" type="text/javascript"></script>
}